class Animal(object):
    """- object 是Python中所有类的最终父类
        - 它定义了所有Python对象共有的基本方法
        - 在Python 3中，即使不显式继承 object ，类也会自动继承它
    """
    def __init__(self, name):
        self.name = name
    def eat(self):
        print(self.name + ' is eating.')

class Dog(Animal):
    def __init__(self, name):
        super().__init__(name)# super().__init__() 只负责处理​​属性继承​​
        #Animal.__init__(self, name)
    def eat(self):
        print(self.name + ' is eating meat.')

class Cat(Animal):
    def __init__(self, name):
        Animal.__init__(self, name)
    def eat(self):
        print(self.name + ' is eating fish.')

def eat_all(animals):
    for animal in animals:
        animal.eat()

if __name__ == '__main__':
    animals = [Dog('Dog1'), Dog('Dog2'), Cat('Cat1'), Cat('Cat2')]
    eat_all(animals)